import React, { useEffect, useState } from 'react'

export default function App3() {
  const [count,setCount]=useState(0)
  const [isHot,setIsHot]=useState(true)
  useEffect(()=>{
    console.log('isHot事件执行了');
    return ()=>{
      console.log("isHot的Effect卸载函数" + count);
    }
  },[isHot])
  useEffect(()=>{
    console.log('count执行了');
    return ()=>{
      console.log("count的Effect卸载函数" + isHot);
    }
  },[count])
  return (
    <div>
      <h1>累加的值{count}</h1>
      <hr />
      <h1>今天天气真{isHot?'热':'冷'}</h1>
      <button onClick={()=>{setCount(count+1)}}>加</button>
      <button onClick={()=>{setIsHot(!isHot)}}>改变</button>
    </div>
  )
}
